package com.coconet.gas.rabbitMq.entity;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;

@Data
public class CheckEntity implements Serializable {

    String name;
    String type;
    String cron;
    String[] hosts;
    int groupId;

    public CheckEntity() {

    }

    public CheckEntity(String str) {

        HashMap hashMap = JSON.parseObject(str, HashMap.class);
        name = hashMap.get("name").toString();
        type = hashMap.get("type").toString();
        try {
            cron = hashMap.get("cron").toString();
        } catch (Exception e) {

        }
        hosts = new String[]{hashMap.get("hosts").toString().replaceAll("\"", "")
                .replace("[", "").replace("]", "")};
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCron() {
        return cron;
    }

    public void setCron(String cron) {
        this.cron = cron;
    }

    public String[] getHosts() {
        return hosts;
    }

    public void setHosts(String[] hosts) {
        this.hosts = hosts;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }
}
